package com.csun.cmny.provider.dao;

import com.csun.cmny.provider.dto.CacOldManDto;
import com.csun.cmny.provider.dto.levDto;
import com.csun.cmny.provider.model.vo.CareTypeCountVo;
import com.csun.cmny.provider.pojo.CacOldman;
import com.csun.cmny.provider.vo.CacEvaluateOldManVo;
import com.csun.cmny.util.wrapper.Wrapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface CacOldmanMapper {
    int deleteByPrimaryKey(Integer cacId);

    int insert(CacOldman record);

    int insertSelective(CacOldman record);

    CacOldman selectByPrimaryKey(Integer cacId);

    int updateByPrimaryKeySelective(CacOldman record);

    int updateByPrimaryKey(CacOldman record);

    /**
     * 查询某个机构的评估记录——查询语句需要修改，与老人表进行关联查询
     * author:liqian
     * date:2018-11-05 14:31
     */
    List<Map<String, Object>> showAll(Map<String, Object> queryMap);

    List<Map<String,Object>> getCacOldmanInfo(Map queryMap);

    int deleteByOldmanId(Integer oldmanId);

    /**
     * 根据评估状态查询评估记录,查询老人最新记录,且在半年或者半年以上的
     * @param cacOldManDto
     * @return
     */
    List<CacEvaluateOldManVo> showByType(CacOldManDto cacOldManDto);

    /**
     * 分页查询评估记录--武昌版
     * @param cacOldManDto
     * @return
     */
    List<CacEvaluateOldManVo> showAllWithPage(CacOldManDto cacOldManDto);

    /**
     * 根据老人ID,组织机构ID,评估类型查询评估记录
     * @param cacOldManDto
     * @return
     */
    List<CacEvaluateOldManVo> queryCac(CacOldManDto cacOldManDto);

    /**
     * 按护理类型统计老人数量
     * @param: [groupId]
     * @return: java.util.List<com.csun.cmny.provider.model.vo.CareTypeCountVo>
     */
    List<CareTypeCountVo> queryOldmanNumGroupByCareType(@Param("oldmanIdList") List<Integer> oldmanIdList);

    /**
     * 查询超过六个月未评估的老人
     * @param: [groupId]
     * @return: java.util.List<java.lang.Integer>
     */
    List<Integer> queryNeedDailyEvaluateOldmanIdList(@Param("groupId") Long groupId);

    /**
     * 查询每个老人最新一条评估记录
     * @param: [cacOldManDto]
     * @return: java.util.List<CacEvaluateOldManVo>
     */
    List<CacEvaluateOldManVo> listTheLastestEvaluateRecordByOldmanIdList(CacOldManDto cacOldManDto);

    List<CacEvaluateOldManVo> newlistTheLastestEvaluateRecordByOldmanIdList(CacOldManDto cacOldManDto);

    List<CareTypeCountVo> queryOldmanNumGroupByLevelCareId(@Param("oldmanIdList")List<Integer> oldmanIdList);

    String selectlevelCareNameByNewCreateTime(Long levelCareId);

    List<Map<String,Object>> selectCacOldManAll();

    Integer updateLevelCare(Map<String, Object> updateDto);
}